package org.dromara.rocketmq.demo.consumer;


import com.alibaba.fastjson.JSON;
import com.cloud.rocketmq.base.entity.CloudMessage;
import com.cloud.rocketmq.spring.annotation.ConsumeTopic;
import com.cloud.rocketmq.spring.core.TopicListener;
import lombok.extern.slf4j.Slf4j;
import org.dromara.rocketmq.demo.producer.SendDTO;


/**
 * @description: 监听普通消息
 * @author: zhou shuai
 * @date: 2022/1/12 16:26
 * @version: v1
 */
@Slf4j
@ConsumeTopic(topic = "TP_DTO_TEST_TOPIC", eventCode = "EC_TEST_DTO", log = true)
public class MessageDTOTestListener implements TopicListener<SendDTO> {

    @Override
    public void onMessage(CloudMessage<SendDTO> message) {
        SendDTO sendDTO = message.getPayload();
        log.info("EC_TEST_DTO接收到消息:{}", JSON.toJSONString(sendDTO));
    }

}
